package com.example.saiweisi.controller.systemAdminController;

import com.example.saiweisi.common.Result;
import com.example.saiweisi.service.interf.IStatisticsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/statistics")
@RestController
@CrossOrigin
@Slf4j
public class StatisticsController {
    @Autowired
    IStatisticsService statisticsService;
    //  timeRange: week month month2 month3
    @GetMapping("/{timeRange}")
    public Result lineCharts(@PathVariable String timeRange) {
        return Result.success(statisticsService.getCountByTimeRange(timeRange));
    }
    @GetMapping("/getData")
    public Result getData() {
        return Result.success(statisticsService.getData());
    }
}
